home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / Preinstalled MacPerl (FAT) / t / op / write.t < prev   
Encoding:
Text File  |  1995-07-02  |  2.3 KB  |  137 lines  |  [TEXT/McPL]

  1. #!./perl
  2.  
  3. # $RCSfile: write.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:38 $
  4.  
  5. print "1..3\n";
  6.  
  7. format OUT =
  8. the quick brown @<<
  9. $fox
  10. jumped
  11. @*
  12. $multiline
  13. ^<<<<<<<<<
  14. $foo
  15. ^<<<<<<<<<
  16. $foo
  17. ^<<<<<<...
  18. $foo
  19. now @<<the@>>>> for all@|||||men to come @<<<<
  20. {
  21.     'i' . 's', "time\n", $good, 'to'
  22. }
  23. .
  24.  
  25. open(OUT, '>Op_write.tmp') || die "Can't create Op_write.tmp";
  26.  
  27. $fox = 'foxiness';
  28. $good = 'good';
  29. $multiline = "forescore\nand\nseven years\n";
  30. $foo = 'when in the course of human events it becomes necessary';
  31. write(OUT);
  32. close OUT;
  33.  
  34. $right =
  35. "the quick brown fox
  36. jumped
  37. forescore
  38. and
  39. seven years
  40. when in
  41. the course
  42. of huma...
  43. now is the time for all good men to come to\n";
  44.  
  45. # if (`cat Op_write.tmp` eq $right)
  46. if (`catenate Op_write.tmp` eq $right)
  47.     { print "ok 1\n"; unlink 'Op_write.tmp'; }
  48. else
  49.     { print "not ok 1\n"; }
  50.  
  51. format OUT2 =
  52. the quick brown @<<
  53. $fox
  54. jumped
  55. @*
  56. $multiline
  57. ^<<<<<<<<< ~~
  58. $foo
  59. now @<<the@>>>> for all@|||||men to come @<<<<
  60. 'i' . 's', "time\n", $good, 'to'
  61. .
  62.  
  63. open OUT2, '>Op_write.tmp' or die "Can't create Op_write.tmp";
  64.  
  65. $fox = 'foxiness';
  66. $good = 'good';
  67. $multiline = "forescore\nand\nseven years\n";
  68. $foo = 'when in the course of human events it becomes necessary';
  69. write(OUT2);
  70. close OUT2;
  71.  
  72. $right =
  73. "the quick brown fox
  74. jumped
  75. forescore
  76. and
  77. seven years
  78. when in
  79. the course
  80. of human
  81. events it
  82. becomes
  83. necessary
  84. now is the time for all good men to come to\n";
  85.  
  86. # if (`cat Op_write.tmp` eq $right)
  87. if (`catenate Op_write.tmp` eq $right)
  88.     { print "ok 2\n"; unlink 'Op_write.tmp'; }
  89. else
  90.     { print "not ok 2\n"; }
  91.  
  92. eval <<'EOFORMAT';
  93. format OUT2 =
  94. the brown quick @<<
  95. $fox
  96. jumped
  97. @*
  98. $multiline
  99. and
  100. ^<<<<<<<<< ~~
  101. $foo
  102. now @<<the@>>>> for all@|||||men to come @<<<<
  103. 'i' . 's', "time\n", $good, 'to'
  104. .
  105. EOFORMAT
  106.  
  107. open(OUT2, '>Op_write.tmp') || die "Can't create Op_write.tmp";
  108.  
  109. $fox = 'foxiness';
  110. $good = 'good';
  111. $multiline = "forescore\nand\nseven years\n";
  112. $foo = 'when in the course of human events it becomes necessary';
  113. write(OUT2);
  114. close OUT2;
  115.  
  116. $right =
  117. "the brown quick fox
  118. jumped
  119. forescore
  120. and
  121. seven years
  122. and
  123. when in
  124. the course
  125. of human
  126. events it
  127. becomes
  128. necessary
  129. now is the time for all good men to come to\n";
  130.  
  131. # if (`cat Op_write.tmp` eq $right)
  132. if (`catenate Op_write.tmp` eq $right)
  133.     { print "ok 3\n"; unlink 'Op_write.tmp'; }
  134. else
  135.     { print "not ok 3\n"; }
  136.  
  137.